package mirrormonkey.core.member;

import java.util.Arrays;

import mirrormonkey.framework.entity.StaticEntityData.MemberDataKey;

public class PresentKey implements MemberDataKey {

	protected final ConstructorData data;

	public PresentKey(ConstructorData data) {
		this.data = data;
	}

	public int parameterCount() {
		return data.interpreters.length;
	}

	@Override
	public final int hashCode() {
		return parameterCount() * PresentKey.class.hashCode();
	}

	@Override
	public final boolean equals(Object o) {
		if (o.getClass().equals(PresentKey.class)) {
			return Arrays.deepEquals(
					((PresentKey) o).data.constr.getParameterTypes(),
					data.constr.getParameterTypes());
		} else if (SearchKey.class.isInstance(o)) {
			return ((SearchKey) o).equals(this);
		}
		return false;
	}
}